package cn.zswltech.gruul.xxljob;

import cn.zswltech.gruul.common.dal.tkmybatis.IMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;

/**
 * @author Jim
 * @version 1.0.0
 * @descripition:
 * @date 2024/2/19 11:33
 */
@Mapper
public interface YunHuUserMapper extends IMapper<YunHuUser> {

    @Insert("<script>" +
            "insert into yunhu_user(emp_id, emp_age, pos_code, emp_name, edu_bg_name, dep_name, dep_code, edu_bg_code, pos_name, emp_status_code, org_name, emp_status_name, org_code, gmt_create, gmt_modified)\n" +
            "values\n" +
            "<foreach collection=\"list\" item=\"item\" separator=\",\">\n" +
            "(\n" +
            "#{item.empId},\n" +
            "#{item.empAge},\n" +
            "#{item.posCode},\n" +
            "#{item.empName},\n" +
            "#{item.eduBgName},\n" +
            "#{item.depName},\n" +
            "#{item.depCode},\n" +
            "#{item.eduBgCode},\n" +
            "#{item.posName},\n" +
            "#{item.empStatusCode},\n" +
            "#{item.orgName},\n" +
            "#{item.empStatusName},\n" +
            "#{item.orgCode},\n" +
            "#{item.gmtCreate},\n" +
            "#{item.gmtModified}\n" +
            "    )" +
            "</foreach>\n" +
            "</script>")
    void batchSave(List<YunHuUser> yunHuUsers);

    @Delete("<script>" +
            "delete from yunhu_user where emp_id in\n" +
            "<foreach collection=\"list\" open=\"(\" close=\")\" item=\"item\" separator=\",\">\n" +
            "    #{item}\n" +
            "</foreach>" +
            "</script>")
    void batchDeleteByPrimaryKeys(List<String> empIds);
}
